package com.fristvue.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fristvue.dao.OrderDao;
import com.fristvue.po.Order;
import com.fristvue.po.Util.Page;
import com.fristvue.po.Util.ShopUtil;
import com.fristvue.service.OrderService;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderDao orderDao;
	/**
	 * 分页查询
	 */
	@Override
	public Page<Order> listOrdersAll(Integer num, Integer size, ShopUtil shopUtil) {
		// TODO Auto-generated method stub
		Page<Order> page = new Page<Order>();
		page.setList(this.orderDao.listOrdersAll(num, size, shopUtil));
		page.setNum(this.orderDao.countOrder(shopUtil));
		return page;
	}
	/**
	 * 添加订单数据
	 */
	@Override
	public boolean OrderAdd(Order order) {
		// TODO Auto-generated method stub
		return this.orderDao.OrderAdd(order);
	}
	/**
	 * 删除订单
	 */
	@Override
	public boolean DeleteOrder(Integer id) {
		// TODO Auto-generated method stub
		return this.orderDao.DeleteOrder(id);
	}
	/**
	 * 找到订单详细信息
	 */
	@Override
	public Order orderById(Integer id) {
		// TODO Auto-generated method stub
		return this.orderDao.orderById(id);
	}
	/**
	 * 更改订单数据
	 */
	@Override
	public boolean updateOrderById(Order order) {
		// TODO Auto-generated method stub
		return this.orderDao.updateOrderById(order);
	}
}
